package com.lagou.homework2.no1;

public class ArraysTest {
    public static void main(String[] args) {
        ArraysEntity arraysEntity = new ArraysEntity(16,16);
        //调用生成数组的方法并打印
        int[][] arrays = arraysEntity.setValues();
        for(int m=0;m<arrays.length;m++){
            for(int n=0;n<arrays[m].length;n++){
                System.out.print(arrays[m][n]+" ");
            }
            System.out.println();
        }
        //计算并打印每行的和
        int[] sumRows = arraysEntity.sumRows();
        for (int z=0;z<sumRows.length;z++){
            int cnt =z+1;
            System.out.println("第"+cnt+"行的和是："+sumRows[z]);
        }
        //计算并打印每列的和
        int[] sumCells = arraysEntity.sumCells();
        for (int f=0;f<sumCells.length;f++){
            int cnt =f+1;
            System.out.println("第"+cnt+"列的和是："+sumCells[f]);
        }
        //计算左上角到右下角的和并打印
        System.out.println("从左上角到右上角的和为："+arraysEntity.sumLeft_Right());
        //计算右上角到左下角的和并打印
        System.out.println("从右上角到左上角的和为："+arraysEntity.sumRight_Left());
    }
}
